OK = 0
VCODE_ERROR = 1000
LOGIN_REQUIRE = 1001
USER_NOT_EXIST = 1002
PROFILE_ERROR = 1003


class LogicError(Exception):
    code = 0

    def __str__(self):
        return self.__class__.__name__


def generate_logic_error(name, code):
    base_class = (LogicError,)
    return type(name, base_class, {'code': code})


Ok = generate_logic_error('OK', 0)
VcodeError = generate_logic_error('VcodeError', 1000)
VcodeExist = generate_logic_error('VcodeExist', 1001)
LoginRequire = generate_logic_error('LoginRequire', 1002)
UserNotExist = generate_logic_error('UserNotExist', 1003)
ProfileError = generate_logic_error('ProfileError', 1004)
